# -*- coding: utf-8 -*-

class Country(object):
    '''
    Country infomation
    '''
    def __init__(self):
        self.cid = 0
        self.name_cn = ''
        self.name_en = ''
        self.name_cnt = ''
        self.name = self.name_cn
        self.abbr = ''

def _load_contries():
    countries = {}
    with open('./countries.db') as f:
        for line in f.readlines():
            item = Country()
            info_list = line.split('\t')
            item.abbr = info_list[0]
            item.name_cn = info_list[1]
            item.name_en = info_list[2]
            item.cid = info_list[3].rstrip()
            countries[item.name_cn] = item.cid
            # print item.cid, item.name_en, item.abbr, item.name_cn, item.name
    return countries

def _init_countries():
    pass


def calculate():
    pass

if __name__ == '__main__':
    countries = _load_contries()
    for name, cid in countries.items():
        print name, cid
    if countries.has_key('多米尼加共和国'):
        print 'id of USA is', countries['多米尼加共和国']
